AJAX

Display Record's Description Through AJAX

Description
This customization utilizes the power of AJAX to make an asynchronous call to an AJAX method. The AJAX method queries the database to retrieve values for any selected record in a table control and displays the details in a JavaScript popup window. You will need to implement two JavaScript functions to call the AJAX method and to receive the asynchronous callback.
Variables
Table Name
Select the database table whose field values need to be displayed
Record ID
Select the field that corresponds to the record ID for the selected table
Description Field
Select the field containing the description that needs to be displayed in the JavaScript popup window
Applies to
Page class
Code
 
    /// 
    /// All web methods need to be defined with the WebMethod tag.
    /// 
    [System.Web.Services.WebMethod()]
    public static string GetRecordDescription(int MyRecordID)
    {
        // For INTEGER Id's
        string whereStr = " ${Record ID} = " + MyRecordID;
        // For STRING Id's, comment out above line and uncomment below line.
        // string whereStr = " ${Record ID} = '" + MyRecordID + "'";

       ${${Table Name}RecordClassName} selectedRecord  = ${${Table Name}ClassName}.GetRecord(whereStr);

        // In this example the description of the selected record is retrieved
        string content = "The description for the selected record is " + selectedRecord.${Description Field};

        return content;
    }
     

Terms of Service Privacy Statement